package com.matrix.maprender;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputAdapter;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.OrthographicCamera;

public class ChickGameInput extends InputAdapter{

	private float i;
	private boolean bClick1;
	private OrthographicCamera camera;
	public ChickGameInput(OrthographicCamera camera){
		i = 0;
		bClick1 = false;
		this.camera = camera;
	}
	
	@Override
	public boolean touchDown(int x, int y, int pointer, int button) {
//		System.out.println(i);
//		i++;
		getDoubleClick();
		return false;
	}
	private void getDoubleClick(){ //Neu double click trong vong 0.5s
		if ( bClick1 == false )
			bClick1 = true;
		else{
			System.out.println("Zoom 2x");
			if ( camera.zoom == 1f )
				camera.zoom = 0.5f;
			else
				camera.zoom = 1f;
			bClick1 = false;
			i = 0;
		}
			
	}
	public void render(){
		i += Gdx.graphics.getDeltaTime();
//		System.out.println(i);
		if ( i > 0.8 ){
			bClick1 = false;
			i = 0;
		}
	}
}
